package com.shqcjd.yunweiyanoperator.ui.adapter;

import android.view.View;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.shqcjd.yunweiyanoperator.R;
import com.shqcjd.yunweiyanoperator.model.pojo.ChannelUser;

import butterknife.BindView;
import butterknife.ButterKnife;
import de.hdodenhof.circleimageview.CircleImageView;

/**
 * Created by sy on 2019/5/13.
 */

public class RemoteUserListAdapter extends BaseQuickAdapter<ChannelUser,RemoteUserListAdapter.ViewHolder> {

    public RemoteUserListAdapter() {
        super(R.layout.item_remote_user);
    }

    @Override
    protected void convert(RemoteUserListAdapter.ViewHolder helper, ChannelUser item) {
        RequestOptions options = new RequestOptions()
                .placeholder(R.mipmap.ic_default_tx)    //加载成功之前占位图
                .error(R.mipmap.ic_default_tx) ;   //加载错误之后的错误图
//                .override(57, 57);//指定图片的缩放类型为centerCrop （等比例缩放图片，直到图片的宽高都
        Glide.with(mContext)
                .load(item.headImg)
                .apply(options)
                .into(helper.civ_icon);

        helper.tv_name.setText(item.userName);
    }

    class ViewHolder extends BaseViewHolder {
        @BindView(R.id.civ_icon)
        CircleImageView civ_icon;
        @BindView(R.id.tv_name)
        TextView tv_name;
        public ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }

}
